package com.tkmybatis.service.impl;

import com.tkmybatis.domain.EptOrgResource;
import com.tkmybatis.hfy.base.entity.PageBean;
import com.tkmybatis.hfy.base.mapper.BaseMapper;
import com.tkmybatis.hfy.base.service.impl.BaseServiceImpl;
import com.tkmybatis.mapper.EptOrgResourceMapper;
import com.tkmybatis.service.EptOrgResourceService;
import com.tkmybatis.vo.DemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;


@Service
public class EptOrgResourceServiceImpl extends BaseServiceImpl<EptOrgResource> implements EptOrgResourceService {

    @Autowired
    private EptOrgResourceMapper eptOrgResourceMapper;
    @Override
    public BaseMapper<EptOrgResource> getMapper() {
        return this.eptOrgResourceMapper;
    }

    @Override
    public List<EptOrgResource> listOrgResource(String parentId) {
        EptOrgResource record = new EptOrgResource();
        record.setParentCode(parentId);
        return super.select(record);
    }

    @Override
    public String getName(String id) {
        return super.selectByPrimaryKey(id).getOrganName();
    }

    @Override
    public PageBean<EptOrgResource> findListMapByParentId(String parentId,Integer pageNum,Integer pageSize) {
       if(pageNum==null){
           pageNum=1;
       }
       if(pageSize==null){
           pageSize=10;
       }

        setPage(pageNum,pageSize);
        Map<String,Object> hashMap=new HashMap<String,Object>();
        hashMap.put("parentCode",parentId);
        List<EptOrgResource> eptOrgResources = eptOrgResourceMapper.findListMapByParentId(hashMap);
        return new PageBean<>(eptOrgResources);
    }



    @Override
    public List<DemVo> findSalaryByDempNum2() {
        return eptOrgResourceMapper.findSalaryByDempNum2();
    }

    @Override
    public Integer getByDepNo() {
        return eptOrgResourceMapper.getByDepNo();
    }
}
